unit UnitDadoEmpresa;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, Mask, DBCtrls, Db, DBTables, ExtDlgs, ExtCtrls, Spin;

type
  TFDadoEmpresa = class(TForm)
    Label1: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label5: TLabel;
    SpeedButton1: TSpeedButton;
    Bevel1: TBevel;
    Memo1: TMemo;
    Image1: TDBImage;
    open1: TOpenPictureDialog;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Memo2: TMemo;
    Memo3: TMemo;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    Label6: TLabel;
    Memo4: TMemo;
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Memo3KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
  ST:string;

    { Public declarations }
  end;

var
  FDadoEmpresa: TFDadoEmpresa;

implementation

uses UnitMenu;

{$R *.DFM}

procedure TFDadoEmpresa.SpeedButton1Click(Sender: TObject);
begin
        open1.Execute;
        image1.Picture.LoadFromFile(open1.FileName);

end;

procedure TFDadoEmpresa.BitBtn1Click(Sender: TObject);
begin

  image1.Picture.SaveToFile (extractfilepath(paramstr(0)) + '\imagem\logo.bmp');
  memo1.Lines.SaveToFile(extractfilepath(paramstr(0)) + '\imagem\dado.txt');
  memo2.Lines.SaveToFile(extractfilepath(paramstr(0)) + '\imagem\icm.txt');
  memo3.Lines.SaveToFile(extractfilepath(paramstr(0)) + '\imagem\ipi.txt');
  memo4.Lines.SaveToFile(extractfilepath(paramstr(0)) + '\imagem\lembrete.txt');
  fmenu.label1.caption := memo4.text;
end;

procedure TFDadoEmpresa.FormShow(Sender: TObject);
begin

  if fileexists (extractfilepath(paramstr(0)) + '\imagem\logo.bmp') then
  image1.Picture.loadfromfile(extractfilepath(paramstr(0)) + '\imagem\logo.bmp');

  if fileexists (extractfilepath(paramstr(0)) + '\imagem\dado.txt') then
   memo1.lines.loadfromfile (extractfilepath(paramstr(0)) + '\imagem\dado.txt');

  if fileexists (extractfilepath(paramstr(0)) + '\imagem\icm.txt') then
   memo2.lines.loadfromfile  (extractfilepath(paramstr(0)) + '\imagem\icm.txt');

  if fileexists (extractfilepath(paramstr(0)) + '\imagem\ipi.txt') then
   memo3.lines.loadfromfile  (extractfilepath(paramstr(0)) + '\imagem\ipi.txt');

  if fileexists (extractfilepath(paramstr(0)) + '\imagem\lembrete.txt') then
   memo4.lines.loadfromfile  (extractfilepath(paramstr(0)) + '\imagem\lembrete.txt');

  spinedit1.Text := memo2.Text;
  spinedit2.Text := memo3.Text;

end;

procedure TFDadoEmpresa.Memo3KeyPress(Sender: TObject; var Key: Char);
begin
        if not (key in ['0'..'9']) then abort;
end;

end.
